<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>

<body>

    <script>

        // 简单工厂方法
        function createObjet(name, age) {
            var people = new Object();
            people.name = name;
            people.age = age;
            people.introduce = function () {
                console.log("我叫" + this.name + "，年龄" + this.age);
            }
            return people;
        }
        
        var people1 = createObjet("wx","18");
        people1.introduce();
        var people2 = createObjet("xm","22");
        people2.introduce();

    </script>
</body>

</html>